from pymysql import Connection
conn = Connection(
    host="localhost",         # 主机名
    port=3306,                # 端口号
    user="root",              # 用户
    password="cao20001009",   # 密码
    autocommit=True           # 自动提交事务

)

# print(conn.get_server_info())
cursor = conn.cursor()      # 获取游标对象
# 选择数据库
conn.select_db("world")
# 执行sql
cursor.execute("insert into student values(10002, '林俊杰', 31, '男')")
# # 提交事务
# conn.commit()
# 关闭连接
conn.close()

